﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Service.Utility;
using Utility;

namespace Service.Controllers
{
    /// <summary>
    /// 电机控制API
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class MotorController : ControllerBase
    {
        [HttpGet("up")]
        public ReturnMsg<object> Up()
        {
            new Motor().Up();
            return new ReturnMsg<object>();
        }

        [HttpGet("stop")]
        public ReturnMsg<object> Stop()
        {
            new Motor().Stop();
            return new ReturnMsg<object>();
        }

        [HttpGet("right")]
        public ReturnMsg<object> Right()
        {
            new Motor().Right();
            return new ReturnMsg<object>();
        }

        [HttpGet("left")]
        public ReturnMsg<object> Left()
        {
            new Motor().Left();
            return new ReturnMsg<object>();
        }


        [HttpGet("rev")]
        public ReturnMsg<int> Rev(int values)
        {
            new Motor().Rev(values);
            return new ReturnMsg<int>(values);
        }

        [HttpGet("down")]
        public ReturnMsg<object> Down()
        {
            new Motor().Down();
            return new ReturnMsg<object>();
        }

    }
}
